<template >
    <div>
        <ul>
            <li>消息编号：{{id}}</li>
            <li>消息内容：{{msg}}</li>
        </ul>
    </div>
</template>
<script>
export default {
    name:'Detail',
    props:['id','msg'],
    mounted() {
        // console.log(this.$route)
    },
    //进入守卫：通过路由规则进入该组件时被调用
    beforeRouteEnter (to, from, next) {
        // ...
        console.log('Detail--beforeRouteEnter',to)
        if(to.meta.isAuth){
            if(localStorage.getItem('school')==='lining'){
                next()
            }else{
                alert('学校名称不正确')
            }
        }else{
            next()
        }
    },
    //离开守卫：通过路由规则离开该组件时被调用
    beforeRouteLeave (to, from, next) {
        // ...
        next()
    }
}
</script>
